package com.sq.partner.manager.dao.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.sq.partner.manager.dao.ActirationCardPowerDao;
import com.sq.partner.manager.mybatis.model.GatewayRole;
import com.sq.partner.manager.mybatis.model.GatewayUser;
import com.sq.partner.manager.util.Page;

@Repository
public class ActirationCardPowerDaoImpl extends BaseDaoImpl implements ActirationCardPowerDao {
	
	@SuppressWarnings("unchecked")
	@Override
	public List<GatewayRole> queryroles(String roleNames) throws Exception{
		return (List<GatewayRole>)this.queryList("queryGatewayRoleByActir", roleNames);
	}
	@Override
	public boolean delRoles(HashMap<String,Object> map) throws Exception{
		return this.delete("delUserRoleByActir", map);
	}
	@Override
	public boolean updateUserComPower(GatewayUser user) throws Exception{
		return this.update("updateGatewayUserByActir", user);
	}
	@SuppressWarnings("unchecked")
	@Override
	public Page<GatewayUser> queryUser(Page<GatewayUser> page) throws Exception{
		page.setTotal((Integer)this.query("queryUserByActirCount", page.getMap()));
		page.setData((List<GatewayUser>)this.queryList("queryUserByActir", page.getMap()));
		return page;
	}
	@SuppressWarnings("unchecked")
	@Override
	public List<GatewayRole> queryAllRole(String para) throws Exception{
		return (List<GatewayRole>)this.queryList("queryAllRoleByActir", para);
	}
	@SuppressWarnings("unchecked")
	@Override
	public List<GatewayRole> queryUserRole(String userid) throws Exception{
		return (List<GatewayRole>)this.queryList("queryUserRoleByActir", userid);
	}
}
